package models

import "time"

// ExcelData 表格数据模型
type ExcelData struct {
	ID           int64     `db:"id" json:"id"`
	Username     string    `db:"username" json:"username"`
	TaskID       string    `db:"task_id" json:"task_id"`
	TaskName     string    `db:"task_name" json:"task_name"`
	LiveRoomID   string    `db:"live_room_id" json:"live_room_id"`
	Date         string    `db:"date" json:"date"`
	StartTime    string    `db:"start_time" json:"start_time"`
	EndTime      string    `db:"end_time" json:"end_time"`
	TaskNature   string    `db:"task_nature" json:"task_nature"`
	TaskSource   string    `db:"task_source" json:"task_source"`
	TaskPriority string    `db:"task_priority" json:"task_priority"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time `db:"updated_at" json:"updated_at"`
}

// CreateEdataTable 创建Excel数据表的SQL语句
const CreateEdataTable = `
CREATE TABLE IF NOT EXISTS edata (
    id BIGINT PRIMARY KEY AUTO_INCREMENT,
    username VARCHAR(50) NOT NULL,
    task_id VARCHAR(100) NOT NULL DEFAULT '/',
    task_name VARCHAR(255) NOT NULL,
    live_room_id VARCHAR(100) NOT NULL DEFAULT '/',
    date VARCHAR(20) NOT NULL DEFAULT '/',
    start_time VARCHAR(20) NOT NULL DEFAULT '/',
    end_time VARCHAR(20) NOT NULL DEFAULT '/',
    task_nature VARCHAR(50) NOT NULL DEFAULT '/',
    task_source VARCHAR(50) NOT NULL DEFAULT '/',
    task_priority VARCHAR(50) NOT NULL DEFAULT '/',
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    INDEX idx_username (username),
    INDEX idx_date (date),
    INDEX idx_task_priority (task_priority)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
`
